<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-<#if isUpdate>修改<#else>添加</#if>商品水印">
</@frame.head>
<style>
/*缩略图div*/
.div_show{float:left;background-color: #cccccc; width: 100px;height: 100px;display: inline-block; position: relative;}
.div_show img{ width: 100px;height: 100px;}
.div_show .delete{position: absolute;top: 10px; right: 0px;width: 40px; height: 40px;font-size: 36px;display:none;color:red;}
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> <#if isUpdate>修改<#else>添加</#if>商品水印 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container text-c">
<form method="post" name="save_form"  id="save_form"  action="${contextPath}/product_water_mark/<#if isUpdate>update_product_water_mark<#else>save_product_water_mark</#if>"   enctype="multipart/form-data" target="hidden_frame" >    
   <input type="hidden" name="id" id="productWaterMarkid" value="${(productWaterMark.id?c)!}"  />                        
   <input type="hidden" id="saleProducIds" name="proIds" value="${productWaterMark.wmProductId}"/>
   <input type="hidden" id="saleProductLength" value='${productWaterMark.wmProductId?split(",")?size-1}' />
   
    <table class="table">
      <tr>
        <td width="80px;"><font color="red">*</font>水印名称：</td>
        <td width="120px;"><input type="text" class="input-text  radius"  id="wm_name" name="name" value="${productWaterMark.wmName}"/></td>
        <td></td>
      </tr>
      <tr>
        <td width="80px;"><font color="red">*</font>水印图片：</td>
        <td>
        	   <div  id="showMobWmPic" class="div_show">
	           <#if productWaterMark??&&productWaterMark.wmPicName??>
	           <img src="${imgurl}" data-type="1"/>
	           <#else>
	           <img/>
	           </#if>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="addMobWmPic" ></div>
               </a>
	           </div> 
        <input type="file" name="imageFile" size="1" value="" id="addMobWmPic" class="addImage" data-id="showMobWmPic">
        </td>
        <td>上传png格式的图片，单张图片大小不超过2MB</td>
      </tr>
      <tr>
        <td width="80px;"><font color="red">*</font>显示位置：</td>
        <td>
        <input type="radio"  name="position" id="lt" value="0" onclick="leftTop();" <#if productWaterMark.wmPosition=='0'>checked="checked"</#if>/>商品图片左上角
        <input type="radio"  name="position" id="rt"  value="1" onclick="rightTop();" <#if productWaterMark.wmPosition=='1'>checked="checked"</#if> />商品图片右上角
        <br/><br/>
        <input type="radio" name="position" id="lb"  value="2" onclick="leftBottom();" <#if productWaterMark.wmPosition=='2'>checked="checked"</#if> />商品图片左下角
        <input type="radio" name="position" id="rb"  value="3" onclick="rightBottom();" <#if productWaterMark.wmPosition=='3'>checked="checked"</#if>/>商品图片右下角
        </td>
           <td rowspan ="4"> 
			<div style="position:relative;">									
			<img src="${sybackgrimagePath}"  style="z-index:1; width:180px;height:180px;border: 1px solid #ddd;" />
			<div id="preShowPic"></div>	
			</div>
           </td> 
      </tr>
      <tr>
      <tr>
        <td width="80px;"><font color="red">*</font>开始时间：</td>
        <td>
        <input  type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'%y-%M-%d',maxDate:'#F{$dp.$D(\'endDate\')}',readOnly: true })" id="startDate" 
               value='${(productWaterMark.startDate?string("yyyy-MM-dd HH:mm:ss"))!}' name="startDate"  class="input-text Wdate"></td>
        <td></td>
      </tr>
      <tr>
        <td width="80px;"><font color="red">*</font>结束时间：</td>
        <td>
        <input  type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', minDate:'#F{$dp.$D(\'startDate\')}',readOnly: true })" id="endDate" 
               value='${(productWaterMark.endDate?string("yyyy-MM-dd HH:mm:ss"))!}' name="endDate"    class="input-text Wdate"></td>
         <td></td>
      </tr>
      <tr>
        <td width="80px;"><font color="red">*</font>选择商品：</td>
        <td><button type="button" class="btn btn-primary radius" onclick="toAddProduct();">点击选择商品</button></td>
        <td></td>
      </tr>
      <tr>
         <td></td>
            <td colspan="2">
             <div id="product_id">您已选择${productWaterMark.wmProductId?split(",")?size-1}款商品</div>
             <div  class="text-c">
               <table id="productTable"  class="table table-border table-bordered table-bg">
                     <thead> 
                     <tr>
                        <th >商品编号</th>
                        <th >商品名称</th>
                        <th >供应商</th>
                        <th >商品品牌</th>
                        <th >库存</th> 
                        <th >操作</th>
                     </tr>
                     </thead>
                     <tbody id="productTbody">
                     <#if proList??>
                       <#list proList as product>
                          <tr id="sale${product.id}">
                             <td>${product.id}<input type="hidden" id="${product.id}" name="pro_id"></td>
                             <td>${product.baseInfo.name}</td>
                             <td>${product.merchant.mercName}</td>
                             <td>${brandMap['${product.brandId}']}</td>
                             <td>${product.storeInfo.storeNum}</td>
                             <td><a href="javascript:void(0);"  class="del-c" id="${product.id}">删除</a>
                             </td>
                          </tr>
                       </#list>
                     </#if>
                     </tbody>
               </table>
               </div>
           </td>
      </tr>
      <tr>
        <td colspan="2" style="text-align:center;">
        <button type="button" class="btn btn-success radius" onclick="sub_form();">提交</button>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-secondary radius" onclick="cancle();">取消</button>
        </td>      
        <td></td>  
      </tr>    
    </table>
</form>
</div>
<iframe name="hidden_frame" style="display:none;"></iframe>	
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/product_water_mark/water_mark_add_or_update.js"></script>
<script type="text/javascript">
var path="${contextPath}";
</script>